#import "CustomView.h"

@implementation CustomView

-(void)awakeFromNib
{
    regularImage = [NSImage imageNamed:@"apple"];
    selectedImage = [NSImage imageNamed:@"selected"];

    [self setNeedsDisplay:YES];
}

-(void)drawRect:(NSRect)rect
{
    [[NSColor clearColor] set];
    NSRectFill([self frame]);

    if (isSelected==NO)
		[regularImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
    else
		[selectedImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
}

- (void)setIsSelected:(BOOL)flag
{
	isSelected = flag;
	[self setNeedsDisplay:YES];
}


@end
